import 'package:flutter/material.dart';
import './myFonts.dart';

//ListView列表组件
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('ListView列表组件ListTile前后加图标')),
        body: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        ListTile(leading: Icon(Icons.home), title: Text('首页')),
        Divider(),
        ListTile(
          leading: Icon(Icons.assessment, color: Colors.orange),
          title: Text('全部订单'),
        ),
        Divider(),
        ListTile(
          leading: Icon(Icons.payment, color: Colors.green),
          title: Text("待付款"),
        ),
        Divider(),
        ListTile(
          leading: Icon(Icons.local_car_wash, color: Colors.orange),
          title: Text("待收货"),
        ),
        Divider(),
        ListTile(
          leading: Icon(Icons.favorite, color: Colors.lightGreen),
          title: Text("我的收藏"),
        ),
        Divider(),
        ListTile(
          leading: Icon(Icons.people, color: Colors.black54),//前面加图标
          title: Text("在线客服"),
          trailing: Icon(Icons.chevron_right_sharp,size: 20,color: Colors.blue[900],),//后面加图标
        ),
        Divider(),
      ],
    );
  }
}
